<script setup>
import {ref,onMounted} from 'vue'
import http from '/src/utils/http.js'

const params={
    key:"3bf2fc7d5d2668ec0743b2834271a7d4",
    city:"金华"
}
const weatherData=ref(null)
const getWeather=async()=>{
    const response=await http.get('/simpleWeather/query',{params})
    weatherData.value=response.result;
}
onMounted(()=>{
    getWeather()
})
</script>

<template>
    <div>
        <h1>天气预报（金华）</h1>
        <div>
            <p>温度：{{ weatherData?.temperature }}</p>
            <p>湿度：{{ weatherData?.humidity }}</p>
            <p>空气质量指数：{{ weatherData?.aqi }}</p>
        </div>
    </div>
</template>